﻿Public Class Bathroom

    Dim vAvailability As Integer
    Dim vCleanTime As Integer

    Dim MaxClean As Integer

    Public Property Availability() As Boolean
        Get
            Return vAvailability
        End Get
        Set(ByVal value As Boolean)
            vAvailability = value
        End Set
    End Property

    Public Property CleanTime() As Integer
        Get
            Return vCleanTime
        End Get
        Set(ByVal value As Integer)
            vCleanTime = value
        End Set
    End Property

    Public Sub DecreaseCleanTime()
        If CleanTime > 0 Then
            CleanTime -= 1
        ElseIf CleanTime <= 0 Then
            FinishBathing()
        End If
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        DecreaseCleanTime()
    End Sub

    Private Sub Bathroom_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        MaxClean = 30
    End Sub

    Public Sub StartBathing()
        Timer1.Enabled = True
        Availability = False
    End Sub

    Public Sub FinishBathing()
        'How to finish
        Timer1.Enabled = False
        Availability = True
    End Sub
End Class
